<?php


namespace app\api\vaildate;


class IDCollection extends BaseVaildate
{
    protected $rule = ['ids' => 'require|checkIDs'];

    protected $message = ['ids.checkIDs' => 'ids必须是以,分割的正整数'];

    protected function checkIDs($value)
    {
        $value = explode(',', $value);
        if (!$value) {
            return false;
        }
        foreach ($value as $id) {
            if (!$this->isPostiveInteger($id)) {
                return false;
            }
        }
        return true;
    }
}